package day11;

import java.time.*;

public class Demo3 {
    public static void main(String[] args) {
        //now():当前系统时间
        Instant in = Instant.now();
        //System.out.println(in);
        LocalDate ld = LocalDate.now();
        LocalTime lt = LocalTime.now();
        LocalDateTime ldt = LocalDateTime.now();
        System.out.println("时间戳:"+in);
        System.out.println("日期:"+ld);
        System.out.println("时间"+lt);
        System.out.println("日期时间"+ldt);

        LocalDate ld2 = LocalDate.of(2019, 1, 2);
        LocalTime lt2 = LocalTime.of(1, 2, 3);
        System.out.println(ld2);
        System.out.println(lt2);

        LocalDate time = LocalDate.now();
        DayOfWeek dw = time.getDayOfWeek();
        if (dw == DayOfWeek.FRIDAY) {
            System.out.println("今天是周日");
        }
        else{
            System.out.println("今天不是周日");
        }
        Month m = time.getMonth();
        int m2 = time.getMonthValue();
        System.out.println(m);
        System.out.println(m2);

        time = time.withDayOfYear(100);
        System.out.println(time);
        time = time.withDayOfMonth(20);
        System.out.println(time);

        time=time.with(DayOfWeek.MONDAY);
        System.out.println(time);

        time=time.with(Month.DECEMBER);
        System.out.println(time);

        time = time.minusWeeks(10);
        System.out.println(time);

        time = time.plusMonths(1);
        System.out.println(time);
    }
}
